Mega Code Archive

Categories
1) Android
2) ASP.Net
3) ASP.Net Tutorial
4) C
5) C Tutorial
6) C#
7) C# Book
8) C# by API
9) C# Tutorial
10) C++
11) C++ Tutorial
12) Delphi
13) Flash ActionScript
14) Flex
15) Java
16) Java Book
17) Java by API
18) Java Tutorial
19) JavaScript DHTML
20) JavaScript Reference
21) JavaScript Tutorial
22) MSOfficeExcel 2007 Tutorial
23) MSOfficePowerPoint 2007 Tutorial
24) MSOfficeWord 2007 Tutorial
25) MSSQL
26) MSSQL Tutorial
27) MySQL
28) MySQL Tutorial
29) Oracle PLSQL
30) Oracle PLSQL Tutorial
31) Perl
32) Php
33) PostgreSQL
34) Python
35) Python Tutorial
36) Ruby
37) Silverlight
38) VB.Net
39) VB.Net by API
40) VB.Net Tutorial
41) Visual C++ .NET
42) VisualBasic Script
43) XML
44) XML Tutorial
 
Ruby
1) Active Record
2) Array
3) CGI
4) Class
5) Collections
6) Database
7) Date
8) Design Patterns
9) Development
10) File Directory
11) GUI
12) Hash
13) Language Basics
14) Method
15) Network
16) Number
17) Rails
18) Range
19) Reflection
20) Statement
21) String
22) Threads
23) Time
24) Tk
25) Unit Test
26) Windows Platform
27) XML
Hash
1) A hash ( associative array or a dictionary) is an array holding a collection of data
2) Access any key in a hash that has a default value
3) Access array embedded within a hash
4) Accessing Hashes
5) Add method hash class to invert a hash
6) Add method to Hash class to remove one hash from another
7) Adds the value Six with a key 6 Or you can use []= to change a value
8) Assign key and value pair to a string in hash each method
9) Associate an array converted from a hash
10) Change values in hash in the same way as an array
11) Changes the value associated with the key 2 to Bent
12) Changing Hashes
13) Checking for the presence of keys in a hash
14) Clear a hash
15) Clear method removes all the key-value pairs from a hash, leaving it empty
16) Convert hash to a hash and check the object id
17) Convert hash to array
18) Convert hash to string
19) Create a hash with default value
20) Creates a new default object each time
21) Creating a Hash with a Default Value
22) Creating Hashes
23) Default(key=nil ) Returns the default value
24) Default= Sets the default value
25) Delete element from hash
26) Delete from hash
27) Delete if for a certain value
28) Delete if with block logics
29) Delete_if passes all pairs into the block, so you can delete based on a key or a value
30) Delete_if uses a block
31) Deleting and Clearing a Hash
32) Deleting Hash Elements
33) Deleting Hash Elements Conditionally
34) Each_key method passes only the keys to the block
35) Element Assignment
36) Equality
37) Extract data from the hash by using its keys
38) Find a key-value pair
39) Find all
40) Frozen is kept in variable assignment but not converting
41) Get all keys from a hash
42) Get all values as an array
43) Get an array with all the values from a hash with values
44) Get Hash value by index
45) Grep a hash
46) Hash as a key
47) Hash has a class method [], which is called in either one of two ways
48) Hash inject
49) Hash new with block logic
50) Hash with =
51) Hashes use braces instead of brackets to let the Ruby interpreter know what is being created
52) Hashes Within Hashes
53) If the key is not defined, return the successor of the key
54) Inject with regular expression
55) Instead of integers, you could use strings for the keys
56) Is a hash empty
57) Is it a value in the hash
58) Iterating Through Hash Elements
59) Join hash keys together
60) Loop hash with interpolation
61) Loop through all keys
62) Loop through all values
63) Merge method merges two hashes together, producing a copy of the hashes that removes duplicate keys by overwriting the key-value pair
64) Merge two hashes
65) Merge two hashes with block logics
66) Objects within a hash are given a key that points to them
67) Output hash to string then remove the key and gsub
68) Pass a block to your call to delete
69) Print a hash with PP module
70) Print out a nested hash
71) Printing a Hash
72) Pulling stuff out of zip
73) Rehash Rebuilds the hash based on the current hash values for each key
74) Reject and delete from hash with block
75) Replace a hash with another key-value pair
76) Replace all of the pairs in h with those from another hash
77) Replace hash with a constant
78) Retrieve the values out of a hash based on one or more keys with values_at, also placing the value or values in an array
79) Retrieving Keys
80) Return a value for a given key (one key only) with the index method
81) Return an array containing all the keys in a hash with keys
82) RuntimeError
83) Searching a Hash with Regular Expressions
84) See if it has a given value with value or has_value
85) Shift a hash
86) Sort a hash
87) Sort a hash with sort_by
88) Store new value a hash
89) Swap keys and values
90) Test how big it is with length or size
91) The each_value method passes all the values to a block
92) The hash definition is enclosed in curly braces, whereas an array is defined in square brackets
93) The variable storing the hash is dictionary, and it contains two entries
94) This lazily initialized hash maps integers to their factorials
95) Time value key
96) Update is a synonym for merge!
97) Use each to loop through a hash
98) Use new to create a hash with a default value which is otherwise just nil
99) Use number as hash key
100) Use select to get value by condition
101) Use square brackets to reference the element you wish to retrieve
102) Using Hashes
103) Using merge with a block
104) Using puts on a hash in Ruby doesnt result in as nice a display as it does for arrays
105) Values Returns an array populated with the values fromhsh
106) Values_at(key) Returns an array consisting of values for the given key(s)
107) What if a key does not exist
108) What is the default value for a hash
109) When you sort a hash with the sort method, you get a multidimensional array of two-element arrays in return
110) You can store numbers in hashes
111) You can test to see if a hash is empty with empty
112) You can use the length method on hashes just as you can on arrays